<?php
/**
 * Created by PhpStorm.
 * User: Mloong
 * Date: 2018/11/30
 * Time: 16:11
 */

namespace App\Http\Models;


class Columninfo extends BaseModel
{
    protected $table = 'custom';
    protected $guarded = [];

    public static function delOtherData()
    {
        $data = self::count();
        if ($data != 1) {
            $res = self::orderBy('id', 'desc')->first();
            if ($res) {
                self::where('id', '<', $res->id)->delete();
            } else {
                self::create(['new_user' => 0]);
            }
        }

    }
}